/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.hotel.test.model.impl;

import com.hotel.test.model.TblComment;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import java.io.Serializable;

import java.util.Date;

/**
 * The cache model class for representing TblComment in entity cache.
 *
 * @author Vien-IT
 * @see TblComment
 * @generated
 */
public class TblCommentCacheModel implements CacheModel<TblComment>,
	Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(15);

		sb.append("{commentId=");
		sb.append(commentId);
		sb.append(", userId=");
		sb.append(userId);
		sb.append(", userName=");
		sb.append(userName);
		sb.append(", createDate=");
		sb.append(createDate);
		sb.append(", modifiedDate=");
		sb.append(modifiedDate);
		sb.append(", comment=");
		sb.append(comment);
		sb.append(", hotelId=");
		sb.append(hotelId);
		sb.append("}");

		return sb.toString();
	}

	public TblComment toEntityModel() {
		TblCommentImpl tblCommentImpl = new TblCommentImpl();

		tblCommentImpl.setCommentId(commentId);
		tblCommentImpl.setUserId(userId);

		if (userName == null) {
			tblCommentImpl.setUserName(StringPool.BLANK);
		}
		else {
			tblCommentImpl.setUserName(userName);
		}

		if (createDate == Long.MIN_VALUE) {
			tblCommentImpl.setCreateDate(null);
		}
		else {
			tblCommentImpl.setCreateDate(new Date(createDate));
		}

		if (modifiedDate == Long.MIN_VALUE) {
			tblCommentImpl.setModifiedDate(null);
		}
		else {
			tblCommentImpl.setModifiedDate(new Date(modifiedDate));
		}

		if (comment == null) {
			tblCommentImpl.setComment(StringPool.BLANK);
		}
		else {
			tblCommentImpl.setComment(comment);
		}

		tblCommentImpl.setHotelId(hotelId);

		tblCommentImpl.resetOriginalValues();

		return tblCommentImpl;
	}

	public long commentId;
	public long userId;
	public String userName;
	public long createDate;
	public long modifiedDate;
	public String comment;
	public long hotelId;
}